$(document).ready(function(){     
    var button = $('#upload_grouplogo'), interval;
    var fileType = "pic",fileNum = "one"; 
    new AjaxUpload(button,{
        action: url+'/grouplogo_edit?gid='+gid,
        type:'POST',
        name: 'userfile',
        data:{
        	'gid':'3'
        	/* //传值module:"ajaxupload",
            'buttoninfo':button.text()*/
        },
        responseType:'json',
        onSubmit : function(file, ext){
            if(fileType == "pic")
            {
                if (ext && /^(jpg|png|jpeg|gif)$/.test(ext)){
                    this.setData({
                        'info': '文件类型为图片'
                    });
                } else {
                    $('<li></li>').appendTo('#uplogo_p').text('非图片类型文件，请重传');
                    return false;               
                }
            }
                        
            button.val('文件上传中');
            
            if(fileNum == 'one')
                this.disable();
            
            interval = window.setInterval(function(){
                var text = button.text();
                if (text.length < 14){
                    button.val(text + '.');                    
                } else {
                    button.val('文件上传中');             
                }
            }, 200);
        }, 
        
        onComplete: function(file,response){
        	 
            button.val('修改Logo');

            window.clearInterval(interval);

            this.enable();

            if(response.status == "1"){ 
                var timenow = new Date().getTime();
                $("#group_mainlogo").attr('src',puburl+'/Uploads/GroupLogo/m_'+response.data+'?'+timenow);
	    	$("#group_logoshow").attr('src',puburl+'/Uploads/GroupLogo/m_'+response.data+'?'+timenow);
            }else{
                 alert("上传失败！"); 
            }

    	}//onComplete:

    });//new AjaxUpload结束

});



